package com.example.qfsx;

import android.os.Bundle;
import android.widget.ListView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.qfsx.bean.OrderItem;
import com.example.qfsx.bean.OrderAdapter;

import java.util.ArrayList;
import java.util.List;

public class OrderActivity extends AppCompatActivity {
    ListView listView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_order);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        listView = (ListView) findViewById(R.id.orderListView);
        List<OrderItem> orderList = new ArrayList<>();
        OrderItem goods1=new OrderItem(2073, 5, 10, "京东", 103.4F, 98.7F, 1, "", "2024", "2024", "http://tmp00002.learv.com/qfsx/goods/slsg/ll/100067032357-1.jpg");
        orderList.add(goods1);
        OrderItem goods2=new OrderItem(2072, 5, 4, "果宝", 168F, 138F, 1, "", "2024", "2024", "http://tmp00002.learv.com/qfsx/goods/slsg/ll/10028715658709-1.jpg");
        orderList.add(goods2);
        OrderItem goods3=new OrderItem(1891, 5, 6, "巧鲜", 268F, 138F, 98, "", "2024", "2024", "http://tmp00002.learv.com/qfsx/goods/slsg/ll/10061381309847-1.jpg");
        orderList.add(goods3);
        OrderAdapter adapter=new OrderAdapter(OrderActivity.this,R.layout.order_item, orderList);
        listView.setAdapter(adapter);
    }
}
